import Vue from 'vue'
import App from './App'
import router from './router'
/*iView*/
import iView from 'iview';
import 'iview/dist/styles/iview.css';

Vue.use(iView);
/*百度编辑器*/
import'../static/ue/ueditor.config.js'
import'../static/ue/ueditor.all.min.js'
import'../static/ue/lang/zh-cn/zh-cn.js'
import'../static/ue/ueditor.parse.min.js'
/*axios*/
import axios from 'axios';
Vue.prototype.$axios = axios;
//全局变量
import api from './api';
/*echarts*/
import echarts from 'echarts'

Vue.prototype.$echarts = echarts;

Vue.prototype.$api = api;

Vue.config.productionTip = false;

router.beforeEach((to, from, next) => {
  const role = localStorage.getItem('ms_user');
  if(!role && to.path !== '/login'){
    next('/login');
  }else{
    next();
  }
});

/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  components: { App },
  template: '<App/>'
});
